extends KinematicBody2D

var v := Vector2()
const SPEED = 100

signal shoot(position,rotation,tank)

func _physics_process(delta):
	v.x = 0
	v.y = 0
	if self.is_in_group("Player"):
		if Input.is_action_just_pressed("ui_select"):
			var rotation = $Sprite.rotation_degrees
			emit_signal("shoot",position,rotation,self)
			pass
		if Input.is_action_pressed("ui_left"):
			$Sprite.rotation_degrees = -90
			v.x = -SPEED
		elif Input.is_action_pressed("ui_up"):
			$Sprite.rotation_degrees = 0
			v.y = -SPEED
		elif Input.is_action_pressed("ui_right"):
			$Sprite.rotation_degrees = 90
			v.x = SPEED
		elif Input.is_action_pressed("ui_down"):
			$Sprite.rotation_degrees = 180
			v.y = SPEED
	v = move_and_slide(v)
	
